<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateTagDatasTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('tag_datas', function (Blueprint $table) {
            $table->engine = 'Innodb';
            $table->increments('id');
            $table->integer('tag_id')->default(0)->comment('标签ID 【10000-99999】');
            $table->tinyInteger('category_id')->comment('标签分类');
            $table->tinyInteger('category_child_id')->comment('标签子分类');
            $table->string('tag_name')->comment('标签名称');
            $table->text('data');
            $table->tinyInteger('state')->default(0)->comment('表状态,0正常,1删除');
            $table->timestamps();
            $table->unique('tag_name', 'uqe_tag_name');
            $table->unique('tag_id', 'uqe_tag_id');
            $table->comment = '标签系统';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('tag_datas');
    }
}
